package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.OrdersPageQueryDTO;
import com.sky.entity.Orders;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface HistoryOrderMapper {

    // 分页查询
    Page<Orders> pageQuery4User(OrdersPageQueryDTO ordersPageQueryDTO);

    @Update("update orders set status = #{status} where id = #{id}")
    void cancel(Orders orders);

    Page<Orders> pageQuery(OrdersPageQueryDTO ordersPageQueryDTO);


    /**
     * 根据状态统计订单数量
     * @param status
     */
    @Select("select count(id) from orders where status = #{status}")
    Integer countStatus(Integer status);

    @Update("update orders set status = #{status},delivery_time = #{deliveryTime} where id = #{id}")
    void update(Orders orders);

    @Select("select * from orders where id = #{id}")
    Orders getById(Long id);


    void updatejd(Orders orders);

    @Update("update orders set status = #{status} where id=#{id}")
    void updateps(Orders orders);
}
